<?php


namespace app\api\controller;
use app\api\model\OddsModel;


/**
 * swagger: 盘口
 */
class Odds extends Base
{
    /**
     * post: 获取彩票HTML
     * path: index
     * method: index
     * param: lotteryid - {string} 彩票ID
     */
    public function index($lotteryid = "BJPK10_A"){

        $odds = new OddsModel();
        $map[]=['odds','=',$lotteryid];
        $list =$odds->where($map)->order('id')->select();
        $s = 0;
        $oddslist = [];
        foreach ($list as $key=>$value){
            for($i = 1; $i<27; $i++){
                $oddslist[$s][$i] = $value['h'.$i];

            }
            $s++;
        }

        $data['code'] = 200;

        $data['msg'] = '获取成功';

        $data['datas']=$oddslist;



        if($lotteryid=='BJPK10_A'||$lotteryid=='BJPK10_B'||$lotteryid=='XYFT_A'||$lotteryid=='XYFT_B'||$lotteryid=='JSSC_A'||$lotteryid=='JSSC_B'){
            $data['items']= [
                ['text' => "1-10"],
                ['text' => "冠亚和值"],
                ['text' => "冠军"],
                ['text' => "亚军"],
                ['text' => "季军"],
                ['text' => "第四"],
                ['text' => "第五"],
                ['text' => "第六"],
                ['text' => "第七"],
                ['text' => "第八"],
                ['text' => "第九"],
                ['text' => "第十"],
                ['text' => "1VS10"],
                ['text' => "2VS9"],
                ['text' => "3VS8"],
                ['text' => "4VS7"],
                ['text' => "5VS6"],

            ];
        }



        return json($data);


    }

    /**
     * post: 获得彩种名称
     * path: getName
     * method: getName
     * param: lotteryid - {string} 彩票ID
     */
    public function getidds($lotteryid = "BJPK10_A"){

        $data['code'] = 200;
        $data['data']['datas']['name'] = get_name($lotteryid);
        $data['msg'] = '获取成功';

        return json($data);
    }
    /**
     * post: 获得
     * path: gamename
     * method: gamename
     * param: gamename - {string} 彩票ID
     */
    public function gamename($gamename){
        switch ($gamename){
            case '1-10':
                $name='北京PK拾[A]';
                break;
            case '冠亚和值':
                $name='北京PK拾[A]';
                break;
            case '冠军':
                $name='北京PK拾[B]';
                break;
            case '亚军':
                $name='北京PK拾[B]';
                break;
            case '季军':
                $name='北京PK拾[B]';
                break;
            case '第四':
                $name='北京PK拾[B]';
                break;
            case '第五':
                $name='北京PK拾[B]';
                break;
            case '第六':
                $name='北京PK拾[B]';
                break;
            case '第七':
                $name='北京PK拾[B]';
                break;
            case '第八':
                $name='北京PK拾[B]';
                break;
            case '第九':
                $name='北京PK拾[B]';
                break;
            case '第十':
                $name='北京PK拾[B]';
                break;
            default:
                $name='北京PK拾[A]';

        }

        echo 123;
    }
}